package com.example.xln111.service;

import com.example.xln111.Dao.CourseMapper;
import com.example.xln111.Dao.GradeMapper;
import com.example.xln111.model.Course;
import com.example.xln111.model.Grade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseService {
        @Autowired
        private CourseMapper CourseDao;

        public List<Course> getAllCourses(){
            return CourseDao.getAll();
        }

        public int add(Course course){
            return CourseDao.addCourse(course);
        }

        public int update(Course course){
            return CourseDao.updateCourse(course);
        }

        public int deleteById(int id){ return CourseDao.deleteCourseById(id);}

        public Course getById(int id){
            return CourseDao.getCourseById(id);
        }
    }

